﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;

namespace ModelLayer
{
    [DataContract]
    public class Plane
    {

        [DataMember]
        public List<Seat> Seats { get; set; }
        [DataMember]
        public string PlaneNo { get; set; }
        [DataMember]
        public int TotalSeat { get; set; }
        [DataMember]
        public string PlaneType { get; set; }

        public Plane()
        {
            Seats = new List<Seat>();
        }

        public void AddSeat(Seat _seat)
        {
            Seats.Add(_seat);
        }

        //Overrides equals to compare planes on their planeNo
        public override bool Equals(object _obj)
        {
            bool equal = false;
            Plane objPlane = (Plane) _obj;
            if (PlaneNo.Equals(objPlane.PlaneNo))
            {
                equal = true;
            }
            return equal;
        }
        //Overrides the string representation of the object
        public override string ToString()
        {
            return string.Format("Plane number: {0} \n Total seat: {1} \n Type {2}", PlaneNo, TotalSeat, PlaneType);
        }
    }

}
